/**
 * @FileName Client.java
 * @Package com.designMode.flyweight
 * -------------------------------------
 * @function Please write description of function
 * @Date 2016-1-19 下午3:55:19
 * -------------------------------------
 * Copyright (c) 2016,顾博君 All Rights Reserved.
 */
package com.designMode.flyweight;

/**
 * @author 顾博君
 * @ClassName Client
 * @Date 2016-1-19 下午3:55:19
 * @Function 场景类
 */
public class Client {
    public static void main(String[] args) {
        // fw1和fw2共享了同一个对象
        FlyWeight fw1 = FlyWeightFactory.getFlyWeight("name 1");
        fw1.setIntrinsic("fw1");
        fw1.operate();
        FlyWeight fw2 = FlyWeightFactory.getFlyWeight("name 1");
        fw2.setIntrinsic("fw2");
        fw2.operate();
        // fw3使用了一个新对象
        FlyWeight fw3 = FlyWeightFactory.getFlyWeight("name 3");
        fw3.setIntrinsic("fw3");
        fw3.operate();
    }
}
